$confirm = false;
}
- if ( !$ot->isTalkPage() ) {
+ $oldTalk = $ot->getTalkPage();
+ $considerTalk = ( !$ot->isTalkPage() && $oldTalk->exists() );
+
+ if ( $considerTalk ) {
$wgOut->addWikiText( wfMsg( 'movepagetalktext' ) );
}
</td>
</tr>" );
- if ( ! $ot->isTalkPage() ) {
+ if ( $considerTalk ) {
$wgOut->addHTML( "
<tr>
<td align='right'>
wfRunHooks( 'SpecialMovepageAfterMove', array( &$this , &$ot , &$nt ) ) ;
- # Move talk page if
- # (1) the checkbox says to,
- # (2) the namespaces are not themselves talk namespaces, and of course
- # (3) it exists.
- if ( ( $wgRequest->getVal('wpMovetalk') == 1 ) &&
- !$ot->isTalkPage() &&
- !$nt->isTalkPage() ) {
-
- $ott = $ot->getTalkPage();
- $ntt = $nt->getTalkPage();
-
- # Attempt the move
- $error = $ott->moveTo( $ntt, true, $this->reason );
- if ( $error === true ) {
- $talkmoved = 1;
- wfRunHooks( 'SpecialMovepageAfterMove', array( &$this , &$ott , &$ntt ) ) ;
+ # Move the talk page if relevant, if it exists, and if we've been told to
+ $ott = $ot->getTalkPage();
+ if( $ott->exists() ) {
+ if( $wgRequest->getVal( 'wpMovetalk' ) == 1 && !$ot->isTalkPage() && !$nt->isTalkPage() ) {
+ $ntt = $nt->getTalkPage();
+
+ # Attempt the move
+ $error = $ott->moveTo( $ntt, true, $this->reason );
+ if ( $error === true ) {
+ $talkmoved = 1;
+ wfRunHooks( 'SpecialMovepageAfterMove', array( &$this , &$ott , &$ntt ) ) ;
+ } else {
+ $talkmoved = $error;
+ }
} else {
- $talkmoved = $error;
+ # Stay silent on the subject of talk.
+ $talkmoved = '';
}
} else {
- # Stay silent on the subject of talk.
- $talkmoved = '';
+ $talkmoved = 'notalkpage';
}
# Give back result to user.
function showSuccess() {
global $wgOut, $wgRequest, $wgRawHtml;
-
+
$wgOut->setPagetitle( wfMsg( 'movepage' ) );
$wgOut->setSubtitle( wfMsg( 'pagemovedsub' ) );
- $oldtitle = $wgRequest->getVal('oldtitle');
- $newtitle = $wgRequest->getVal('newtitle');
- $talkmoved = $wgRequest->getVal('talkmoved');
- $text = wfMsg( 'pagemovedtext', $oldtitle, $newtitle );
+ $oldText = $wgRequest->getVal('oldtitle');
+ $newText = $wgRequest->getVal('newtitle');
+ $talkmoved = $wgRequest->getVal('talkmoved');
- # Temporarily disable raw html wikitext option out of XSS paranoia
- $marchingantofdoom = $wgRawHtml;
+ $text = wfMsg( 'pagemovedtext', $oldText, $newText );
+
+ $allowHTML = $wgRawHtml;
$wgRawHtml = false;
$wgOut->addWikiText( $text );
- $wgRawHtml = $marchingantofdoom;
+ $wgRawHtml = $allowHTML;
if ( $talkmoved == 1 ) {
$wgOut->addWikiText( wfMsg( 'talkpagemoved' ) );
} elseif( 'articleexists' == $talkmoved ) {
$wgOut->addWikiText( wfMsg( 'talkexists' ) );
} else {
- $ot = Title::newFromURL( $oldtitle );
- if ( ! $ot->isTalkPage() ) {
+ $oldTitle = Title::newFromText( $oldText );
+ if ( !$oldTitle->isTalkPage() && $talkmoved != 'notalkpage' ) {
$wgOut->addWikiText( wfMsg( 'talkpagenotmoved', wfMsg( $talkmoved ) ) );
}
}